// 文章模块
const fs = require("fs");
const {format} = require("../utils/index");
const path = require("path");

const BASIC_PATH = process.cwd(); // 项目根目录
const ARTICLE_PATH = path.join(BASIC_PATH,"article"); // 文章根目录
let nowDate = format(Date.now()).split(" ");
let nowFolderPath = path.join(ARTICLE_PATH,nowDate[0]); // 文章保存目录

init();

// 文件初始化
function init(){
    if(!fs.existsSync(ARTICLE_PATH)){
        fs.mkdirSync(ARTICLE_PATH);
    }
    if(!fs.existsSync(nowFolderPath)){
        fs.mkdirSync(nowFolderPath);
    }
}

console.log(BASIC_PATH);
console.log(ARTICLE_PATH);
console.log(nowDate);
console.log(nowFolderPath);

global.file_config = {
    BASIC_PATH,ARTICLE_PATH,nowDate,nowFolderPath
}
module.exports = {};